<%@ page import="hp.com.entity.Users" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>

<%
    String path = request.getContextPath();
    request.setAttribute("path",path);
    Users userSession = (Users)request.getSession().getAttribute("userSession");
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<link type="text/css" rel="stylesheet" href="${path}/jbs/css/style.css" />
    <script src="${path}/jbs/js/iepng.js" type="text/javascript"></script>
        <script type="text/javascript">
           EvPNG.fix('div, ul, img, li, input, a'); 
        </script>
    <link rel="icon" href="<%=path%>/jbs/images/ico.ico" type="image/x-icon">
    <script type="text/javascript" src="${path}/jbs/js/jquery-1.8.2.min.js"></script>
    <script type="text/javascript" src="${path}/jbs/js/menu.js"></script>
                
	<script type="text/javascript" src="${path}/jbs/js/n_nav.js"></script>
    
    <script type="text/javascript" src="${path}/jbs/js/select.js"></script>
    
    <script type="text/javascript" src="${path}/jbs/js/num.js">
    	var jq = jQuery.noConflict();
    </script>     
    
    <script type="text/javascript" src="${path}/jbs/js/shade.js"></script>
    <script>
        window.onload=function (){
            checkPriceAll();
        }
        function checkPriceAll(){
            var set=jQuery("*[id^='price_']");
            var finalPrice= document.getElementById("totalPrice")
            var total =parseFloat(parseFloat("0").toFixed(2));
            set.each(function (index,item){
                    total=total+parseFloat(parseFloat(item.textContent).toFixed(2));
                }
            )
            finalPrice.innerHTML= total.toFixed(2);}
    </script>
<title>确认订单-青鸟优选</title>
</head>
<body>
<div class="top">
    <div class="logo"><a href="${path}/Index"><img src="${path}/jbs/images/logo.png" /></a></div>
</div>
<!--End Header End-->
<div class="i_bg">  
    <div class="content mar_20" style="width:fit-content;margin: 5px auto">
    	<div class="Info_r" style="background-color: #02A4d9;color: white">订单确认</div>
    </div>
    
    <!--Begin 第二步：确认订单信息 Begin -->
    <div class="content mar_20" style="margin-bottom: 100px">
    	<div class="two_bg" >
        	<div class="two_sec">
            <div class="two_t">
            	</span>商品列表
            </div>
            <table border="0" class="car_tab" style="width:1110px;margin-top: 20px" cellspacing="0" cellpadding="0">
              <tr>
                <td class="car_th" width="550">商品名称</td>
                <td class="car_th" width="140">属性</td>
                <td class="car_th" width="150">购买数量</td>
                <td class="car_th" width="130">小计</td>
              </tr>
                <c:forEach items="${requestScope.cartDataList}" begin="0" end="${fn:length(requestScope.cartDataList)}" var="item" varStatus="i">
                    <tr class="car_tr" value="${item.dataId}" id="cart_${item.dataId}">
                        <td>
                            <div class="c_s_img"><img src="${item.pic}" width="73" height="73" /></div>
                            ${item.fullname}
                        </td>
                        <td align="center">${item.suk}</td>
                        <td align="center">${item.itemNumber}</td>
                        <td align="center" style="color:#02A4d9;" >¥<span id="price_${i.index}">${item.price}</span></td>
                    </tr>
                </c:forEach>
            </table>
            <a href="${path}/Cart" class="button_r" style="margin:20px 44px">修改</a>
            </div>
            <div class="two_sec">
            <div class="two_t">
                收货人信息
            </div>
            <c:forEach items="${requestScope.addressList}" var="item">
                <table style="margin: 10px auto;border:#02A4d9 1px solid;width: 1100px" border="0" class="peo_tab" style="width:1110px;" cellspacing="0" cellpadding="0" id="addr_${item.id}">
                    <tr>
                    </tr>
                    <tr>
                        <td  rowspan="2" width="6%"><input type="radio" name="address" id="addr_${item.id}" value="${item.id}"></td>
                        <td class="p_td" style="padding-right: 0">详细地址</td>
                        <td colspan="3">${item.locDetail}</td>
                    </tr>
                    <tr>
                        <td class="p_td" width="20%" style="padding-right: 0">联系人</td>
                        <td width="25%">${item.contactName}</td>
                        <td class="p_td" width="20%" style="padding-right: 0">联系电话</td>
                        <td>${item.contactNumber}</td>
                    </tr>
                </table>
            </c:forEach>
            <a href="${path}/Address#addNew" class="button_r" style="margin: 20px 44px">添加新地址</a>
            </div>
            
            <%--<div class="two_t">
            	配送方式
            </div>
            <table border="0" class="car_tab" style="width:1110px;" cellspacing="0" cellpadding="0">
              <tr>
                <td class="car_th" width="80"></td>
                <td class="car_th" width="200">名称</td>
                <td class="car_th" width="370">订购描述</td>
                <td class="car_th" width="150">费用</td>
                <td class="car_th" width="135">免费额度</td>
                <td class="car_th" width="175">保价费用</td>
              </tr>
              <tr>
              	<td align="center"><input type="checkbox" name="ch" checked="checked" /></td>
                <td align="center" style="font-size:14px;"><b>申通快递</b></td>
                <td>江、浙、沪地区首重为15元/KG，其他地区18元/KG，续重均为5-6元/KG， 云南地区为8元</td>
                <td align="center">￥15.00</td>
                <td align="center">￥0.00</td>
                <td align="center">不支持保价</td>
              </tr>
              <tr>
              	<td align="center"><input type="checkbox" name="ch" /></td>
                <td align="center" style="font-size:14px;"><b>城际快递</b></td>
                <td>运费固定</td>
                <td align="center">￥15.00</td>
                <td align="center">￥0.00</td>
                <td align="center">不支持保价</td>
              </tr>
              <tr>
              	<td align="center"><input type="checkbox" name="ch" /></td>
                <td align="center" style="font-size:14px;"><b>邮局平邮</b></td>
                <td>运费固定</td>
                <td align="center">￥15.00</td>
                <td align="center">￥0.00</td>
                <td align="center">不支持保价</td>
              </tr>
              <tr>
              	<td colspan="6">
                	<span class="fr"><label class="r_rad"><input type="checkbox" name="baojia" /></label><label class="r_txt">配送是否需要保价</label></span>
                </td>
              </tr>
            </table> --%>
        </div>
            <div style="border: #02A4d9 2px solid;border-radius: 40px">
            <div style="margin: 0 30px;">
            	<span style="float: left;display: inline-block;margin-top: 30px">支付方式</span>
                <ul class="pay" >
                    <li class="checked">假装支付<div class="ch_img"></div></li>
                </ul>
                <table border="0" style="width:900px;"cellspacing="0" cellpadding="0">
                    <tr height="70">
                        <td align="right">
                            <b style="font-size:14px;">应付款金额：<span style="font-size:22px; color: #02A4d9">￥<span id="totalPrice"></span></span></b>
                        </td>
                    </tr>
                    <tr height="70">
                        <td align="right"><a class="button_r" style="float: right" onclick="orderSubmit()">确认订单</a></td>
                    </tr>
                </table>
                <script>
                    function orderSubmit(){
                        if(jQuery('input:radio[name="address"]:checked').val()==null){
                            alert("请您选择送货地址！")
                            return;
                        }
                       let cart=new Array();
                       let addId=0;
                       jQuery("*[id^='cart_']").each(function(index,item){
                           cart.push((item.id).substr((item.id).indexOf("_")+1));
                        })
                        var radio = document.getElementsByName("address");
                       for (let i = 0; i < radio.length; i++) {
                            if(radio[i].checked){
                                addId=radio[i].value;
                            }
                        }
                       window.location.href="${path}/PlaceOrder?cart="+cart+"&addr="+addId;
                    }
                </script>
            </div>
            <%--<div class="two_t">
            	商品包装
            </div>
            <table border="0" class="car_tab" style="width:1110px;" cellspacing="0" cellpadding="0">
              <tr>
                <td class="car_th" width="80"></td>
                <td class="car_th" width="490">名称</td>
                <td class="car_th" width="180">费用</td>
                <td class="car_th" width="180">免费额度</td>
                <td class="car_th" width="180">图片</td>
              </tr>
              <tr>
              	<td align="center"><input type="checkbox" name="pack" checked="checked" /></td>
                <td><b style="font-size:14px;">不要包装</b></td>
                <td align="center">￥15.00</td>
                <td align="center">￥0.00</td>
                <td align="center"></td>
              </tr>
              <tr>
              	<td align="center"><input type="checkbox" name="pack" /></td>
                <td><b style="font-size:14px;">精品包装</b></td>
                <td align="center">￥15.00</td>
                <td align="center">￥0.00</td>
                <td align="center"><a href="#" style="color:#ff4e00;">查看</a></td>
              </tr>
            </table> 
            
            <div class="two_t">
            	祝福贺卡
            </div>
            <table border="0" class="car_tab" style="width:1110px;" cellspacing="0" cellpadding="0">
              <tr>
                <td class="car_th" width="80"></td>
                <td class="car_th" width="490">名称</td>
                <td class="car_th" width="180">费用</td>
                <td class="car_th" width="180">免费额度</td>
                <td class="car_th" width="180">图片</td>
              </tr>
              <tr>
              	<td align="center"><input type="checkbox" name="wish" checked="checked" /></td>
                <td><b style="font-size:14px;">不要贺卡</b></td>
                <td align="center">￥15.00</td>
                <td align="center">￥0.00</td>
                <td align="center"></td>
              </tr>
              <tr>
              	<td align="center" style="border-bottom:0; padding-bottom:0;"><input type="checkbox" name="wish" /></td>
                <td style="border-bottom:0; padding-bottom:0;"><b style="font-size:14px;">祝福贺卡</b></td>
                <td align="center" style="border-bottom:0; padding-bottom:0;">￥15.00</td>
                <td align="center" style="border-bottom:0; padding-bottom:0;">￥0.00</td>
                <td align="center" style="border-bottom:0; padding-bottom:0;"><a href="#" style="color:#ff4e00;">查看</a></td>
              </tr>
              <tr valign="top">
              	<td align="center"></td>
                <td colspan="4">
                	<span class="fl"><b style="font-size:14px;">祝福语：</b></span>
                    <span class="fl"><textarea class="add_txt" style="width:860px; height:50px;"></textarea></span>
                </td>
              </tr>
            </table> 
            
            <div class="two_t">
            	其他信息
            </div>
            <table border="0" class="car_tab" style="width:1110px;" cellspacing="0" cellpadding="0">
              <tr>
                <td width="145" align="right" style="padding-right:0;"><b style="font-size:14px;">使用红包：</b></td>
                <td>
                	<span class="fl" style="margin-left:50px; margin-right:10px;">选择已有红包</span>
                    <select class="jj" name="city">
                      <option value="0" selected="selected">请选择</option>
                      <option value="1">50元</option>
                      <option value="2">30元</option>
                      <option value="3">20元</option>
                      <option value="4">10元</option>
                    </select>
                    <span class="fl" style="margin-left:50px; margin-right:10px;">或者输入红包序列号</span>
                    <span class="fl"><input type="text" value="" class="c_ipt" style="width:220px;" />
                    <span class="fr" style="margin-left:10px;"><input type="submit" value="验证红包" class="btn_tj" /></span>
                </td>
			  </tr>
              <tr valign="top">
                <td align="right" style="padding-right:0;"><b style="font-size:14px;">订单附言：</b></td>
                <td style="padding-left:0;"><textarea class="add_txt" style="width:860px; height:50px;"></textarea></td>
              </tr>
              <tr>
              	<td align="right" style="padding-right:0;"><b style="font-size:14px;">缺货处理：</b></td>
                <td>
                	<label class="r_rad"><input type="checkbox" name="none" checked="checked" /></label><label class="r_txt" style="margin-right:50px;">等待所有商品备齐后再发</label>
                    <label class="r_rad"><input type="checkbox" name="none" /></label><label class="r_txt" style="margin-right:50px;">取下订单</label>
                    <label class="r_rad"><input type="checkbox" name="none" /></label><label class="r_txt" style="margin-right:50px;">与店主协商</label>
                </td>
              </tr>
            </table>--%>
            </div>
        <td align="right"><a href="${path}/Cart" class="button_r" style="margin-top: 20px">返回购物车</a></td>

    </div>
	<!--End 第二步：确认订单信息 End-->
    
    
    <!--Begin Footer Begin -->
    <div class="btmbg">
        <div class="btm">
            <a href="https://beian.miit.gov.cn">备案/许可证编号：鄂ICP备20008779号-1</a> <br />本站仅供个人学习实践，无实际购买功能
        </div>
    </div>
    <!--End Footer End -->    
</div>

</body>


<!--[if IE 6]>
<script src="${path}/jbs/js/zh_CN.js"></script>
<![endif]-->
</html>
